package com.dimong.www.loan.ui.adapter.holder;


import android.content.Context;
import android.text.TextUtils;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.dimong.loan.sdk.ui.adapter.BaseRecyclerViewHolder;
import com.dimong.www.loan.R;
import com.dimong.www.loan.db.CheckModel;

public class CheckHolder extends BaseRecyclerViewHolder {
    private ImageView type;
    private TextView money;
    private TextView type_mane;
    public CheckHolder(Context context, ViewGroup parent) {
        super(context, R.layout.item_check, parent);
        type = itemView.findViewById(R.id.type);
        money = findViewById(R.id.money);
        type_mane = itemView.findViewById(R.id.type_mane);
    }

    @Override
    public void setData(Object object) {
        super.setData(object);
        if (object instanceof CheckModel) {
            CheckModel checkModel = (CheckModel) object;
            if (checkModel.getType() == 0 || checkModel.getType() == 1) {
                type.setImageResource(R.drawable.travel_blue);
                type_mane.setText("交通");
            }
            if (checkModel.getType() == 2) {
                type.setImageResource(R.drawable.yule_blue);
                type_mane.setText("娱乐");
            }
            if (checkModel.getType() == 3) {
                type.setImageResource(R.drawable.daikuan_blue);
                type_mane.setText("贷款");
            }
            if (checkModel.getType() == 4) {
                type.setImageResource(R.drawable.shenghuo_blue);
                type_mane.setText("生活");
            }
            if (checkModel.getType() == 5) {
                type.setImageResource(R.drawable.canyin_blue);
                type_mane.setText("餐饮");
            }
            if (checkModel.getType() == 6) {
                type.setImageResource(R.drawable.other_blue);
                type_mane.setText("其他");
            }
            money.setText(checkModel.getMoney() + "");
        }

    }
}
